package setclass;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;

public class TreeSetDemo {
    //我要遍历倒序
    public static void main(String[] args) {
        //使用TreeSet查看存取排序
        Set<String> set = new TreeSet<>();
        set.add("java");
        set.add("c++");
        set.add("python");
        //我要倒序遍历
        //混乱排序
        ArrayList<String> list = new ArrayList<>(set);
        Collections.shuffle(list);
        System.out.println( list);
    }
    public static void main1(String[] args) {
        //使用TreeSet查看存取排序
        Set<String> set = new TreeSet<>();
        set.add("java");
        set.add("c++");
        set.add("python");

        System.out.println(set);
        if (set.contains("java")){
            System.out.println("包含java");
            set.remove("java");
        }
        System.out.println(set);

    }
}
